//
// Ephi - simulation of magnetic fields and particles
// Copyright (C) 2007 Indrek Mandre <indrek(at)mare.ee>
// For more information please see http://www.mare.ee/indrek/ephi/
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#include "ephi.hpp"

// perpendicular look through the corners of the cube polywell

int main (int argc, char *argv[])
{
  {
  Statics statics;
  ElectroDynamics dyn(statics);
  make_polywell_cube (statics, 0.3, 0.02, 0.005, 100000, 0.00001);
  fprintf (stderr, "Calculating the cube configuration...\n");
  Scene scene(dyn);
  Screen screen(800, 800, 1.3, 1.3);
  screen.set_axis (vect3d(0, 0, 0), vect3d(1, 1, 0).normal(), vect3d(0, 0, 1));

  scene.calc (screen);
  scene.set_coloring (32, true);
  scene.render_map (screen);
  screen.write ("polywell_pcp_bfield_logcolor_step.bmp");
  printf ("OK: polywell_pcp_bfield_logcolor_step.bmp written..\n");
  scene.set_coloring (0, true); // logarithmic full scale
  scene.render_lic (screen);
  screen.write ("polywell_pcp_bfield_lic_logcolor.bmp");

  scene.calc (screen, Scene::CALC_EFIELD);
  scene.set_coloring (32, true);
  scene.render_map (screen);
  screen.write ("polywell_pcp_efield_logcolor_step.bmp");
  printf ("OK: polywell_pcp_efield_logcolor_step.bmp written..\n");
  scene.set_coloring (0, true); // logarithmic full scale
  scene.render_lic (screen);
  screen.write ("polywell_pcp_efield_lic_logcolor.bmp");
  }
  return 0;
}

